From: Daniel Kinzler Date: Sat, 28 Jun 2008 19:40:14 +0000 (+0000) Subject: adding debug messages to ajax dispatcher X-Git-Tag: 1.31.0-rc.0~46851 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=ef0d2694e2f22475d0363d00e1376663c4d60247;p=lhc%2Fweb%2Fwiklou.git adding debug messages to ajax dispatcher --- diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php index c3d4ea9558..c489cf1cef 100644 --- a/includes/AjaxDispatcher.php +++ b/includes/AjaxDispatcher.php @@ -86,9 +86,13 @@ class AjaxDispatcher { wfProfileIn( __METHOD__ ); if (! in_array( $this->func_name, $wgAjaxExportList ) ) { + wfDebug( __METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n" ); + wfHttpError( 400, 'Bad Request', "unknown function " . (string) $this->func_name ); } else { + wfDebug( __METHOD__ . ' dispatching ' . $this->func_name . "\n" ); + if ( strpos( $this->func_name, '::' ) !== false ) { $func = explode( '::', $this->func_name, 2 ); } else { @@ -98,6 +102,10 @@ class AjaxDispatcher { $result = call_user_func_array($func, $this->args); if ( $result === false || $result === NULL ) { + wfDebug( __METHOD__ . ' ERROR while dispatching ' + . $this->func_name . "(" . var_export( $this->args, true ) . "): " + . "no data returned\n" ); + wfHttpError( 500, 'Internal Error', "{$this->func_name} returned no data" ); } @@ -108,9 +116,15 @@ class AjaxDispatcher { $result->sendHeaders(); $result->printText(); + + wfDebug( __METHOD__ . ' dispatch complete for ' . $this->func_name . "\n" ); } } catch (Exception $e) { + wfDebug( __METHOD__ . ' ERROR while dispatching ' + . $this->func_name . "(" . var_export( $this->args, true ) . "): " + . get_class($e) . ": " . $e->getMessage() . "\n" ); + if (!headers_sent()) { wfHttpError( 500, 'Internal Error', $e->getMessage() );